package com.gary.controller;

import com.gary.entity.Department;
import com.gary.mapper.IDepartmentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * (Department)表控制层
 *
 * @author makejava
 * @since 2020-11-25 16:26:37
 */
@RestController
@RequestMapping("department")
public class DepartmentController {
    /**
     * 服务对象
     */
    @Autowired
    private IDepartmentMapper iDepartmentMapper;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("/selectOne")
    public Department selectOne(Integer id) {
        Department department = this.iDepartmentMapper.queryById(id);
        System.out.println(department);
        return department;
    }

    @GetMapping("/insertDept")
    public void insertDept(Department department) {
        iDepartmentMapper.insertDept(department);
    }

}